package com.tx.java.chapter10.exercise10_6.demo1;

/**
 *
 */
public class BaseClass {

    public BaseClass(int i){

    }
    public BaseClass(){

    }

    public void print(){}

    public static BaseClass getBaseClass(int i){
        return new BaseClass(){ //匿名内部类，相当于创建了一个继承BaseClass的导出类
            private int num ;
            {
                num = i;
            }
            public void print(){
                System.out.println(num);
            }
        };
    }

    public static void main(String[] args) {
        BaseClass b = getBaseClass(1);
        b.print();
    }
}